package com.iengoo.edu.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author zpym
 * @CopyRight (C) http://www.iengoo.com
 * @brief 数据库配置文件读取类
 * @email 122162005@qq.com
 * @date 2019-01-22 15:47
 */
public class DBConfig {
    public static String username;
    public static String password;
    public static String driver;
    public static String url;

    static {
        // 创建数据库配置文件对象
        Properties prop = new Properties();
        // 获取配置文件输入流
        InputStream resource = DBConfig.class.getClassLoader().getResourceAsStream("jdbc.properties");
        try {
            prop.load(resource);
        } catch (IOException e) {
            e.printStackTrace();
        }
        username = prop.getProperty("username");
        password = prop.getProperty("password");
        driver = prop.getProperty("driver");
        url = prop.getProperty("url");
    }
}
